/**
 * @author Kelvin Qi
 */
//get the hostname
function hostname_f(has_protocol_b, url_s, has_port_b) {/* shawl.qiu, return string, func:none */
  url_s = url_s||document.URL;  
  has_protocol_b = has_protocol_b||false;
  has_port_b = has_port_b||has_port_b;
  
  var result_url_s = '';
    
  if(has_protocol_b){result_url_s = url_s.slice(0, url_s.indexOf('/', url_s.indexOf('://') + 3));}
  else{ result_url_s = url_s.slice(url_s.indexOf('://') + 3, url_s.indexOf('/', url_s.indexOf('://') + 3)); }  
  
  if(!has_port_b){result_url_s = result_url_s.replace(/\:[\d]+$/, '');}
  
  return result_url_s;
}/* function hostname_f(has_protocol_b, url_s, has_port_b) */